<?php

abstract class CC_Helpdesk_Rule_Abstract
{
    protected $_ticket;
    protected $_ruleExpressions = array();
    
    /**
     * Contructor
     * 
     * @param CC\Entity\Ticket $ticket Ticket to apply rule to
     * @param string $ruleExpression Rule expression
     * @param CC\Entity\Folder $folder Destination folder to assign ticket to
     */
    public function __construct(CC\Entity\Ticket $ticket = null, $ruleExpression = null)
    {
        $this->_ticket = $ticket;
        
        if($ruleExpression !== null || $ruleExpression == '')
        {
            $this->_ruleExpressions = CC_Inflector::parseParamString($ruleExpression);
        }
    }
    
    /**
     * 
     */
    abstract public function parse();
    
    /**
     * Ticket accessor
     * @return CC\Entity\Ticket
     */
	public function getTicket()
    {
        return $this->_ticket;
    }

    /**
     * Rule accessor
     * @return string
     */
	public function getRuleExpression()
    {
        return $this->_ruleExpression;
    }

    /**
     * Ticket mutator
     * @param CC\Entity\Ticket $ticket
     */
	public function setTicket(CC\Entity\Ticket $ticket)
    {
        $this->_ticket = $ticket;
        return $this;
    }

    /**
     * Rule mutator
     * @param string $ruleExpression
     */
	public function setRuleExpression($ruleExpression)
    {
        $this->_ruleExpressions = CC_Inflector::parseParamString($ruleExpression);
        return $this;
    }
}
?>